/* Licensed to the Apache Software Foundation (ASF) under one or more
 * contributor license agreements.  See the NOTICE file distributed with
 * this work for additional information regarding copyright ownership.
 * The ASF licenses this file to You under the Apache License, Version 2.0
 * (the "License"); you may not use this file except in compliance with
 * the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

#include "zobjects_gtk.h"

ZlangInvokeFunction ZlangInvokeFunction_guibutton_Create_guiwindow;
int ZlangInvokeFunction_guibutton_Create_guiwindow( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	struct ZlangDirectProperty_guibutton		*guibutton_direct_prop = GetObjectDirectProperty(out1) ;
	struct ZlangDirectProperty_guiwidget_common	*guibutton_common = & (guibutton_direct_prop->common) ;

	EVAL_GTK_WIDGET_NEW_IN_CREATE( guibutton_common->gtk_widget , gtk_button_new() )
	SET_CONTROL_DEFAULT_STYLE( in1 , guibutton_common->gtk_widget )

	TRANSFER_INPUT_OBJECT_TO_NEW_OBJECT( guibutton_common->guiwindow_obj , in1 )

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guibutton_Create_guiwindow_string;
int ZlangInvokeFunction_guibutton_Create_guiwindow_string( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*in2 = GetInputParameterInLocalObjectStack(rt,2) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	char						*str = NULL ;
	struct ZlangDirectProperty_guibutton		*guibutton_direct_prop = GetObjectDirectProperty(out1) ;
	struct ZlangDirectProperty_guiwidget_common	*guibutton_common = & (guibutton_direct_prop->common) ;

	CallRuntimeFunction_string_GetStringValue( rt , in2 , & str , NULL );

	EVAL_GTK_WIDGET_NEW_IN_CREATE( guibutton_common->gtk_widget , gtk_button_new_with_label(str) )

	TRANSFER_INPUT_OBJECT_TO_NEW_OBJECT( guibutton_common->guiwindow_obj , in1 )

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guibutton_Create_guiwindow_string_functionptr;
int ZlangInvokeFunction_guibutton_Create_guiwindow_string_functionptr( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*in2 = GetInputParameterInLocalObjectStack(rt,2) ;
	struct ZlangObject				*in3 = GetInputParameterInLocalObjectStack(rt,3) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	char						*str = NULL ;
	struct ZlangDirectProperty_guibutton		*guibutton_direct_prop = GetObjectDirectProperty(out1) ;
	struct ZlangDirectProperty_guiwidget_common	*guibutton_common = & (guibutton_direct_prop->common) ;

	CallRuntimeFunction_string_GetStringValue( rt , in2 , & str , NULL );

	EVAL_GTK_WIDGET_NEW_IN_CREATE( guibutton_common->gtk_widget , gtk_button_new_with_label(str) )

	TRANSFER_INPUT_OBJECT_TO_NEW_OBJECT( guibutton_common->guiwindow_obj , in1 )

	ADD_CONTROL_GENERAL_CALLBACK_IN_CREATE( guibutton_common->guiwindow_obj , out1 , GTK_EVENT_CLICKED , in3 )

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guibutton_Create_guiwindow_functionptr_string;
int ZlangInvokeFunction_guibutton_Create_guiwindow_functionptr_string( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*in2 = GetInputParameterInLocalObjectStack(rt,2) ;
	struct ZlangObject				*in3 = GetInputParameterInLocalObjectStack(rt,3) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	char						*icon_name = NULL ;
	struct ZlangDirectProperty_guibutton		*guibutton_direct_prop = GetObjectDirectProperty(out1) ;
	struct ZlangDirectProperty_guiwidget_common	*guibutton_common = & (guibutton_direct_prop->common) ;

	CallRuntimeFunction_string_GetStringValue( rt , in3 , & icon_name , NULL );

	EVAL_GTK_WIDGET_NEW_IN_CREATE( guibutton_common->gtk_widget , gtk_button_new_from_icon_name(icon_name) )

	TRANSFER_INPUT_OBJECT_TO_NEW_OBJECT( guibutton_common->guiwindow_obj , in1 )

	ADD_CONTROL_GENERAL_CALLBACK_IN_CREATE( guibutton_common->guiwindow_obj , out1 , GTK_EVENT_CLICKED , in2 )

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guibutton_Create_guiwindow_functionptr_string_int;
int ZlangInvokeFunction_guibutton_Create_guiwindow_functionptr_string_int( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*in2 = GetInputParameterInLocalObjectStack(rt,2) ;
	struct ZlangObject				*in3 = GetInputParameterInLocalObjectStack(rt,3) ;
	struct ZlangObject				*in4 = GetInputParameterInLocalObjectStack(rt,4) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	char						*icon_name = NULL ;
	int32_t						icon_size ;
	struct ZlangDirectProperty_guibutton		*guibutton_direct_prop = GetObjectDirectProperty(out1) ;
	struct ZlangDirectProperty_guiwidget_common	*guibutton_common = & (guibutton_direct_prop->common) ;

	CallRuntimeFunction_string_GetStringValue( rt , in3 , & icon_name , NULL );
	CallRuntimeFunction_int_GetIntValue( rt , in4 , & icon_size );

	EVAL_GTK_WIDGET_NEW_IN_CREATE( guibutton_common->gtk_widget , gtk_button_new_from_icon_name(icon_name) )
	gtk_widget_set_size_request( guibutton_common->gtk_widget , icon_size , icon_size );

	TRANSFER_INPUT_OBJECT_TO_NEW_OBJECT( guibutton_common->guiwindow_obj , in1 )

	ADD_CONTROL_GENERAL_CALLBACK_IN_CREATE( guibutton_common->guiwindow_obj , out1 , GTK_EVENT_CLICKED , in2 )

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guibutton_Create_guiwindow_string_functionptr_string;
int ZlangInvokeFunction_guibutton_Create_guiwindow_string_functionptr_string( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*in2 = GetInputParameterInLocalObjectStack(rt,2) ;
	struct ZlangObject				*in3 = GetInputParameterInLocalObjectStack(rt,3) ;
	struct ZlangObject				*in4 = GetInputParameterInLocalObjectStack(rt,4) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	char						*label = NULL ;
	char						*icon_name = NULL ;
	struct ZlangDirectProperty_guibutton		*guibutton_direct_prop = GetObjectDirectProperty(out1) ;
	struct ZlangDirectProperty_guiwidget_common	*guibutton_common = & (guibutton_direct_prop->common) ;

	CallRuntimeFunction_string_GetStringValue( rt , in2 , & label , NULL );
	CallRuntimeFunction_string_GetStringValue( rt , in4 , & icon_name , NULL );

	EVAL_GTK_WIDGET_NEW_IN_CREATE( guibutton_common->gtk_widget , gtk_button_new_with_label(label) )
	gtk_button_set_icon_name( GTK_BUTTON(guibutton_common->gtk_widget) , icon_name );

	TRANSFER_INPUT_OBJECT_TO_NEW_OBJECT( guibutton_common->guiwindow_obj , in1 )

	ADD_CONTROL_GENERAL_CALLBACK_IN_CREATE( guibutton_common->guiwindow_obj , out1 , GTK_EVENT_CLICKED , in3 )

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guibutton_Create_guiwindow_string_functionptr_string_int;
int ZlangInvokeFunction_guibutton_Create_guiwindow_string_functionptr_string_int( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*in2 = GetInputParameterInLocalObjectStack(rt,2) ;
	struct ZlangObject				*in3 = GetInputParameterInLocalObjectStack(rt,3) ;
	struct ZlangObject				*in4 = GetInputParameterInLocalObjectStack(rt,4) ;
	struct ZlangObject				*in5 = GetInputParameterInLocalObjectStack(rt,5) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	char						*label = NULL ;
	char						*icon_name = NULL ;
	int32_t						icon_size ;
	struct ZlangDirectProperty_guibutton		*guibutton_direct_prop = GetObjectDirectProperty(out1) ;
	struct ZlangDirectProperty_guiwidget_common	*guibutton_common = & (guibutton_direct_prop->common) ;

	CallRuntimeFunction_string_GetStringValue( rt , in2 , & label , NULL );
	CallRuntimeFunction_string_GetStringValue( rt , in4 , & icon_name , NULL );
	CallRuntimeFunction_int_GetIntValue( rt , in5 , & icon_size );

	EVAL_GTK_WIDGET_NEW_IN_CREATE( guibutton_common->gtk_widget , gtk_button_new_with_label(label) )
	gtk_button_set_icon_name( GTK_BUTTON(guibutton_common->gtk_widget) , icon_name );
	gtk_widget_set_size_request( guibutton_common->gtk_widget , icon_size , icon_size );

	TRANSFER_INPUT_OBJECT_TO_NEW_OBJECT( guibutton_common->guiwindow_obj , in1 )

	ADD_CONTROL_GENERAL_CALLBACK_IN_CREATE( guibutton_common->guiwindow_obj , out1 , GTK_EVENT_CLICKED , in3 )

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guibutton_SetLabel_string;
int ZlangInvokeFunction_guibutton_SetLabel_string( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guibutton		*guibutton_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	char						*str = NULL ;

	CallRuntimeFunction_string_GetStringValue( rt , in1 , & str , NULL );

	gtk_button_set_label( GTK_BUTTON(guibutton_direct_prop->common.gtk_widget) , str );

	TRANSFER_MASTER_OBJECT_TO_OUTPUT_OBJECT

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guibutton_SetFrame_bool;
int ZlangInvokeFunction_guibutton_SetFrame_bool( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guibutton		*guibutton_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	unsigned char					b ;

	CallRuntimeFunction_bool_GetBoolValue( rt , in1 , & b );

	gtk_button_set_has_frame( GTK_BUTTON(guibutton_direct_prop->common.gtk_widget) , b );

	TRANSFER_MASTER_OBJECT_TO_OUTPUT_OBJECT

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guibutton_SetClickEventCallback_functionptr;
int ZlangInvokeFunction_guibutton_SetClickEventCallback_functionptr( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guibutton		*guibutton_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangDirectProperty_guiwidget_common	*guibutton_common = & (guibutton_direct_prop->common) ;
	struct ZlangObject				*in1 = GetInputParameterInLocalObjectStack(rt,1) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;

	ADD_CONTROL_GENERAL_CALLBACK_IN_CREATE( guibutton_common->guiwindow_obj , obj , GTK_EVENT_CLICKED , in1 )

	TRANSFER_MASTER_OBJECT_TO_OUTPUT_OBJECT

	return 0;
}

ZLANG_INVOKE_FUNCTION_guiwidget_all_common_functions( button )

ZLANG_INVOKE_FUNCTION_guictl_all_common_functions( button )

ZlangInvokeFunction ZlangInvokeFunction_guibutton_GetLabel;
int ZlangInvokeFunction_guibutton_GetLabel( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guibutton		*guibutton_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	char						*str = NULL ;

	str = (char*)gtk_button_get_label( GTK_BUTTON(guibutton_direct_prop->common.gtk_widget) ) ;

	CallRuntimeFunction_string_SetStringValue( rt , out1 , str , STRLEN_OF_STRING );

	return 0;
}

ZlangInvokeFunction ZlangInvokeFunction_guibutton_HasFrame;
int ZlangInvokeFunction_guibutton_HasFrame( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guibutton		*guibutton_direct_prop = GetObjectDirectProperty(obj) ;
	struct ZlangObject				*out1 = GetOutputParameterInLocalObjectStack(rt,1) ;
	unsigned char					b ;

	b = gtk_button_get_has_frame( GTK_BUTTON(guibutton_direct_prop->common.gtk_widget) ) ;

	CallRuntimeFunction_bool_SetBoolValue( rt , out1 , b );

	return 0;
}

ZlangCreateDirectPropertyFunction ZlangCreateDirectProperty_guibutton;
void *ZlangCreateDirectProperty_guibutton( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guibutton		*guibutton_prop = NULL ;
	struct ZlangDirectProperty_guiwidget_common	*guibutton_common = NULL ;
	
	guibutton_prop = (struct ZlangDirectProperty_guibutton *)ZLMALLOC( sizeof(struct ZlangDirectProperty_guibutton) ) ;
	if( guibutton_prop == NULL )
	{
		SET_RUNTIME_ERROR( rt , RUNTIME_ERROR , ZLANG_ERROR_ALLOC , "alloc memory for entity" )
		return NULL;
	}
	memset( guibutton_prop , 0x00 , sizeof(struct ZlangDirectProperty_guibutton) );

	guibutton_common = (struct ZlangDirectProperty_guiwidget_common *)guibutton_prop ;
	guibutton_common->gtk_widget_type_id = GTK_TYPE_BUTTON ;

	INIT_ZLANGDIRECTPROPERTY_guiwidget_common(guibutton)
	
	return guibutton_prop;
}

ZlangDestroyDirectPropertyFunction ZlangDestroyDirectProperty_guibutton;
void ZlangDestroyDirectProperty_guibutton( struct ZlangRuntime *rt , struct ZlangObject *obj )
{
	struct ZlangDirectProperty_guibutton	*guibutton_direct_prop = GetObjectDirectProperty(obj) ;

	CLEAN_ZLANGDIRECTPROPERTY_guiwidget_common(guibutton)

	ZLFREE( guibutton_direct_prop );
	
	return;
}

ZlangSummarizeDirectPropertySizeFunction ZlangSummarizeDirectPropertySize_guibutton;
void ZlangSummarizeDirectPropertySize_guibutton( struct ZlangRuntime *rt , struct ZlangObject *obj , size_t *summarized_obj_size , size_t *summarized_direct_prop_size )
{
	SUMMARIZE_SIZE( summarized_direct_prop_size , sizeof(struct ZlangDirectProperty_guibutton) )
	return;
}

static struct ZlangDirectFunctions direct_funcs_guibutton =
	{
		ZLANG_OBJECT_guibutton , /* char *ancestor_name */
		
		ZlangCreateDirectProperty_guibutton , /* ZlangCreateDirectPropertyFunction *create_entity_func */
		ZlangDestroyDirectProperty_guibutton , /* ZlangDestroyDirectPropertyFunction *destroy_entity_func */
		
		NULL , /* ZlangFromCharPtrFunction *from_char_ptr_func */
		NULL , /* ZlangToStringFunction *to_string_func */
		NULL , /* ZlangFromDataPtrFunction *from_data_ptr_func */
		NULL , /* ZlangGetDataPtrFunction *get_data_ptr_func */
		
		NULL , /* ZlangOperatorFunction *oper_PLUS_func */
		NULL , /* ZlangOperatorFunction *oper_MINUS_func */
		NULL , /* ZlangOperatorFunction *oper_MUL_func */
		NULL , /* ZlangOperatorFunction *oper_DIV_func */
		NULL , /* ZlangOperatorFunction *oper_MOD_func */
		
		NULL , /* ZlangUnaryOperatorFunction *unaryoper_NEGATIVE_func */
		NULL , /* ZlangUnaryOperatorFunction *unaryoper_NOT_func */
		NULL , /* ZlangUnaryOperatorFunction *unaryoper_BIT_REVERSE_func */
		NULL , /* ZlangUnaryOperatorFunction *unaryoper_PLUS_PLUS_func */
		NULL , /* ZlangUnaryOperatorFunction *unaryoper_MINUS_MINUS_func */
		
		NULL , /* ZlangCompareFunction *comp_EGUAL_func */
		NULL , /* ZlangCompareFunction *comp_NOTEGUAL_func */
		NULL , /* ZlangCompareFunction *comp_LT_func */
		NULL , /* ZlangCompareFunction *comp_LE_func */
		NULL , /* ZlangCompareFunction *comp_GT_func */
		NULL , /* ZlangCompareFunction *comp_GE_func */
		
		NULL , /* ZlangLogicFunction *logic_AND_func */
		NULL , /* ZlangLogicFunction *logic_OR_func */
		
		NULL , /* ZlangLogicFunction *bit_AND_func */
		NULL , /* ZlangLogicFunction *bit_XOR_func */
		NULL , /* ZlangLogicFunction *bit_OR_func */
		NULL , /* ZlangLogicFunction *bit_MOVELEFT_func */
		NULL , /* ZlangLogicFunction *bit_MOVERIGHT_func */
		
		ZlangSummarizeDirectPropertySize_guibutton , /* ZlangSummarizeDirectPropertySizeFunction *summarize_direct_prop_size_func */
	} ;

ZlangImportObjectFunction ZlangImportObject_guibutton;
struct ZlangObject *ZlangImportObject_guibutton( struct ZlangRuntime *rt )
{
	struct ZlangObject	*obj = NULL ;
	struct ZlangObject	*prop = NULL ;
	struct ZlangFunction	*func = NULL ;
	int			nret = 0 ;
	
	nret = ImportObject( rt , & obj , ZLANG_OBJECT_guibutton , & direct_funcs_guibutton , sizeof(struct ZlangDirectFunctions) , NULL ) ;
	if( nret )
	{
		SET_RUNTIME_ERROR( rt , RUNTIME_ERROR , ZLANG_ERROR_LINK_FUNC_TO_ENTITY , "import object to global objects heap" )
		return NULL;
	}
	
	prop = AddPropertyInObject( rt , obj , GetIntObjectInRuntimeObjectsHeap(rt) , "BUTTONS_OK") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_int_SetIntValue( rt , prop , GUIBUTTONS_OK );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , GetIntObjectInRuntimeObjectsHeap(rt) , "BUTTONS_OK_CANCEL") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_int_SetIntValue( rt , prop , GUIBUTTONS_OK_CANCEL );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , GetIntObjectInRuntimeObjectsHeap(rt) , "BUTTONS_YES_NO") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_int_SetIntValue( rt , prop , GUIBUTTONS_YES_NO );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , GetIntObjectInRuntimeObjectsHeap(rt) , "BUTTONS_CANCEL") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_int_SetIntValue( rt , prop , GUIBUTTONS_CANCEL );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , GetIntObjectInRuntimeObjectsHeap(rt) , "BUTTONS_CLOSE") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_int_SetIntValue( rt , prop , GUIBUTTONS_CLOSE );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , GetIntObjectInRuntimeObjectsHeap(rt) , "BUTTONS_YES_NO_CANCEL") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_int_SetIntValue( rt , prop , GUIBUTTONS_YES_NO_CANCEL );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , GetIntObjectInRuntimeObjectsHeap(rt) , "BUTTON_ACCEPT") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_int_SetIntValue( rt , prop , GUIBUTTON_ACCEPT );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , GetIntObjectInRuntimeObjectsHeap(rt) , "BUTTON_OK") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_int_SetIntValue( rt , prop , GUIBUTTON_OK );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , GetIntObjectInRuntimeObjectsHeap(rt) , "BUTTON_CANCEL") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_int_SetIntValue( rt , prop , GUIBUTTON_CANCEL );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , GetIntObjectInRuntimeObjectsHeap(rt) , "BUTTON_YES") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_int_SetIntValue( rt , prop , GUIBUTTON_YES );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , GetIntObjectInRuntimeObjectsHeap(rt) , "BUTTON_NO") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_int_SetIntValue( rt , prop , GUIBUTTON_NO );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , GetIntObjectInRuntimeObjectsHeap(rt) , "BUTTON_CLOSE") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_int_SetIntValue( rt , prop , GUIBUTTON_CLOSE );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , GetStringObjectInRuntimeObjectsHeap(rt) , "ICON_NAME_DOCUMENT_NEW") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_string_SetStringValue( rt , prop , GUIICONNAME_DOCUMENT_NEW , STRLEN_OF_STRING );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , GetStringObjectInRuntimeObjectsHeap(rt) , "ICON_NAME_DOCUMENT_OPEN") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_string_SetStringValue( rt , prop , GUIICONNAME_DOCUMENT_OPEN , STRLEN_OF_STRING );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , GetStringObjectInRuntimeObjectsHeap(rt) , "ICON_NAME_DOCUMENT_SAVE") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_string_SetStringValue( rt , prop , GUIICONNAME_DOCUMENT_SAVE , STRLEN_OF_STRING );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , GetStringObjectInRuntimeObjectsHeap(rt) , "ICON_NAME_DOCUMENT_SAVE_AS") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_string_SetStringValue( rt , prop , GUIICONNAME_DOCUMENT_SAVE_AS , STRLEN_OF_STRING );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , GetStringObjectInRuntimeObjectsHeap(rt) , "ICON_NAME_APPLICATION_EXIT") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_string_SetStringValue( rt , prop , GUIICONNAME_APPLICATION_EXIT , STRLEN_OF_STRING );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , GetStringObjectInRuntimeObjectsHeap(rt) , "ICON_NAME_EDIT_UNDO") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_string_SetStringValue( rt , prop , GUIICONNAME_EDIT_UNDO , STRLEN_OF_STRING );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , GetStringObjectInRuntimeObjectsHeap(rt) , "ICON_NAME_EDIT_REDO") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_string_SetStringValue( rt , prop , GUIICONNAME_EDIT_REDO , STRLEN_OF_STRING );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , GetStringObjectInRuntimeObjectsHeap(rt) , "ICON_NAME_EDIT_CUT") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_string_SetStringValue( rt , prop , GUIICONNAME_EDIT_CUT , STRLEN_OF_STRING );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , GetStringObjectInRuntimeObjectsHeap(rt) , "ICON_NAME_EDIT_COPY") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_string_SetStringValue( rt , prop , GUIICONNAME_EDIT_COPY , STRLEN_OF_STRING );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , GetStringObjectInRuntimeObjectsHeap(rt) , "ICON_NAME_EDIT_PASTE") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_string_SetStringValue( rt , prop , GUIICONNAME_EDIT_PASTE , STRLEN_OF_STRING );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , GetStringObjectInRuntimeObjectsHeap(rt) , "ICON_NAME_EDIT_DELETE") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_string_SetStringValue( rt , prop , GUIICONNAME_EDIT_DELETE , STRLEN_OF_STRING );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , GetStringObjectInRuntimeObjectsHeap(rt) , "ICON_NAME_GO_BACK") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_string_SetStringValue( rt , prop , GUIICONNAME_GO_BACK , STRLEN_OF_STRING );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , GetStringObjectInRuntimeObjectsHeap(rt) , "ICON_NAME_GO_FORWARD") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_string_SetStringValue( rt , prop , GUIICONNAME_GO_FORWARD , STRLEN_OF_STRING );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , GetStringObjectInRuntimeObjectsHeap(rt) , "ICON_NAME_GO_HOME") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_string_SetStringValue( rt , prop , GUIICONNAME_GO_HOME , STRLEN_OF_STRING );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , GetStringObjectInRuntimeObjectsHeap(rt) , "ICON_NAME_LIST_ADD") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_string_SetStringValue( rt , prop , GUIICONNAME_LIST_ADD , STRLEN_OF_STRING );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , GetStringObjectInRuntimeObjectsHeap(rt) , "ICON_NAME_LIST_REMOVE") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_string_SetStringValue( rt , prop , GUIICONNAME_LIST_REMOVE , STRLEN_OF_STRING );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , GetIntObjectInRuntimeObjectsHeap(rt) , "SMALL_ICON_SIZE") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_int_SetIntValue( rt , prop , GUIICONSIZE_SMALL_TOOLBAR_BUTTON );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , GetIntObjectInRuntimeObjectsHeap(rt) , "MIDDLE_ICON_SIZE") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_int_SetIntValue( rt , prop , GUIICONSIZE_MIDDLE_TOOLBAR_BUTTON );
	SetConstantObject( prop );
	
	prop = AddPropertyInObject( rt , obj , GetIntObjectInRuntimeObjectsHeap(rt) , "LARGE_ICON_SIZE") ;
	if( prop == NULL )
		return NULL;
	CallRuntimeFunction_int_SetIntValue( rt , prop , GUIICONSIZE_LARGE_TOOLBAR_BUTTON );
	SetConstantObject( prop );
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guibutton_Create_guiwindow , ZLANG_OBJECT_guibutton , "Create" , ZLANG_OBJECT_guiwindow,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guibutton_Create_guiwindow_string , ZLANG_OBJECT_guibutton , "Create" , ZLANG_OBJECT_guiwindow,NULL , ZLANG_OBJECT_string,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guibutton_Create_guiwindow_string_functionptr , ZLANG_OBJECT_guibutton , "Create" , ZLANG_OBJECT_guiwindow,NULL , ZLANG_OBJECT_string,NULL , ZLANG_OBJECT_functionptr,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guibutton_Create_guiwindow_functionptr_string , ZLANG_OBJECT_guibutton , "Create" , ZLANG_OBJECT_guiwindow,NULL , ZLANG_OBJECT_functionptr,NULL , ZLANG_OBJECT_string,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guibutton_Create_guiwindow_functionptr_string_int , ZLANG_OBJECT_guibutton , "Create" , ZLANG_OBJECT_guiwindow,NULL , ZLANG_OBJECT_functionptr,NULL , ZLANG_OBJECT_string,NULL , ZLANG_OBJECT_int,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guibutton_SetLabel_string , ZLANG_OBJECT_guibutton , "SetLabel" , ZLANG_OBJECT_string,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guibutton_SetFrame_bool , ZLANG_OBJECT_guibutton , "SetFrame" , ZLANG_OBJECT_bool,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guibutton_SetClickEventCallback_functionptr , ZLANG_OBJECT_guibutton , "SetClickEventCallback" , ZLANG_OBJECT_functionptr,NULL , NULL ) ;
	if( func == NULL )
		return NULL;
	
	ADD_FUNCTION_AND_PARAMETERS_IN_OBJECT_guiwidget_all_common_functions( button )

	ADD_FUNCTION_AND_PARAMETERS_IN_OBJECT_guictl_all_common_functions( button )

	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guibutton_GetLabel , ZLANG_OBJECT_string , "GetLabel" , NULL ) ;
	if( func == NULL )
		return NULL;
	
	func = AddFunctionAndParametersInObject( rt , obj , ZlangInvokeFunction_guibutton_HasFrame , ZLANG_OBJECT_guibutton , "HasFrame" , NULL ) ;
	if( func == NULL )
		return NULL;
	
	return obj ;
}

